using System;
using Microsoft.Xna.Framework.Graphics;
using RebEngine.Interfaces;
using RebEngine.Managers;

namespace RebEngine.Models
{
    public class RebModel : IRebModel
    {
 
        private string _fileName;
        private Model _baseModel;
        private bool _readyToRender = false;

        public string FileName
        {
            get { return _fileName; }
            set { _fileName = value; }
        }
        public Model BaseModel
        {
            get { return _baseModel; }
        }
        public bool ReadyToRender
        {
            get { return _readyToRender; }
        }

        public RebModel(string fileName)
        {
            _fileName = fileName;
        }

        public void LoadContent()
        {
            if (!String.IsNullOrEmpty(_fileName))
            {
                try
                {
                    _baseModel = EngineManager.ContentManager.Load<Model>("Content/Models/" + _fileName);
                    _readyToRender = true;
                }
                catch
                {
                    LogManager.Write("ModelManager: Failed to load " + _fileName);
                }
            }
        }
    }
}
